package javaapplication2;

import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class FilterOutputStreamDemo {
    public static void main(String[] args) throws Exception {
        OutputStream os = null;
        FilterOutputStream fos = null;
        try {
            os = new FileOutputStream("C://test.txt");
            fos = new FilterOutputStream(os);
            fos.close();
            fos.write(65);
        } catch (IOException e) {
            System.out.print("Close() is invoked prior to write()");
        } finally {
            if (os != null) {
                os.close();
            }
            if (fos != null) {
                fos.close();
            }
        }
    }
}
